using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

using FridayShopping.DataModel;
using FridayShopping.UI.ListFormManagers;

namespace FridayShopping.UI
{
	/// <summary>
	/// Summary description for StatisticsForm.
	/// </summary>
	public class StatisticsForm : System.Windows.Forms.Form , IListViewForm
	{
		private System.Windows.Forms.MainMenu mainMenu1;
		private System.Windows.Forms.ColumnHeader columnHeader_Key;
		private System.Windows.Forms.ColumnHeader columnHeader_Product;
		private System.Windows.Forms.ColumnHeader columnHeader_Count;
		private System.Windows.Forms.ToolBar toolBar;
		private System.Windows.Forms.ListView statsListView;
		private System.Windows.Forms.ColumnHeader columnHeader_AvgAmount;
		public System.Windows.Forms.ToolBarButton toolBarButton_Usual;
		private System.Windows.Forms.ImageList imageList1;
		private System.Windows.Forms.ToolBarButton toolBarButton_Delete;
	

		private ListFormManager listFormManager;

		public StatisticsForm(IItemList list)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			toolBar.ImageList = imageList1;
			toolBar.Buttons[0].ImageIndex = 0;
			toolBar.Buttons[1].ImageIndex = 1;

			listFormManager = new StatsListFormManager(this, statsListView, list);

		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(StatisticsForm));
			this.statsListView = new System.Windows.Forms.ListView();
			this.columnHeader_Key = new System.Windows.Forms.ColumnHeader();
			this.columnHeader_Product = new System.Windows.Forms.ColumnHeader();
			this.columnHeader_Count = new System.Windows.Forms.ColumnHeader();
			this.columnHeader_AvgAmount = new System.Windows.Forms.ColumnHeader();
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.toolBar = new System.Windows.Forms.ToolBar();
			this.toolBarButton_Usual = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton_Delete = new System.Windows.Forms.ToolBarButton();
			this.imageList1 = new System.Windows.Forms.ImageList();
			// 
			// statsListView
			// 
			this.statsListView.Columns.Add(this.columnHeader_Key);
			this.statsListView.Columns.Add(this.columnHeader_Product);
			this.statsListView.Columns.Add(this.columnHeader_Count);
			this.statsListView.Columns.Add(this.columnHeader_AvgAmount);
			this.statsListView.Enabled = ((bool)(resources.GetObject("statsListView.Enabled")));
			this.statsListView.FullRowSelect = true;
			this.statsListView.Location = ((System.Drawing.Point)(resources.GetObject("statsListView.Location")));
			this.statsListView.Size = ((System.Drawing.Size)(resources.GetObject("statsListView.Size")));
			this.statsListView.Text = resources.GetString("statsListView.Text");
			this.statsListView.View = System.Windows.Forms.View.Details;
			this.statsListView.Visible = ((bool)(resources.GetObject("statsListView.Visible")));
			this.statsListView.SelectedIndexChanged += new System.EventHandler(this.statsListView_SelectedIndexChanged);
			// 
			// columnHeader_Key
			// 
			this.columnHeader_Key.Text = resources.GetString("columnHeader_Key.Text");
			this.columnHeader_Key.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("columnHeader_Key.TextAlign")));
			this.columnHeader_Key.Width = ((int)(resources.GetObject("columnHeader_Key.Width")));
			// 
			// columnHeader_Product
			// 
			this.columnHeader_Product.Text = resources.GetString("columnHeader_Product.Text");
			this.columnHeader_Product.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("columnHeader_Product.TextAlign")));
			this.columnHeader_Product.Width = ((int)(resources.GetObject("columnHeader_Product.Width")));
			// 
			// columnHeader_Count
			// 
			this.columnHeader_Count.Text = resources.GetString("columnHeader_Count.Text");
			this.columnHeader_Count.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("columnHeader_Count.TextAlign")));
			this.columnHeader_Count.Width = ((int)(resources.GetObject("columnHeader_Count.Width")));
			// 
			// columnHeader_AvgAmount
			// 
			this.columnHeader_AvgAmount.Text = resources.GetString("columnHeader_AvgAmount.Text");
			this.columnHeader_AvgAmount.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("columnHeader_AvgAmount.TextAlign")));
			this.columnHeader_AvgAmount.Width = ((int)(resources.GetObject("columnHeader_AvgAmount.Width")));
			// 
			// toolBar
			// 
			this.toolBar.Buttons.Add(this.toolBarButton_Usual);
			this.toolBar.Buttons.Add(this.toolBarButton_Delete);
			this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick);
			// 
			// toolBarButton_Usual
			// 
			this.toolBarButton_Usual.Enabled = ((bool)(resources.GetObject("toolBarButton_Usual.Enabled")));
			this.toolBarButton_Usual.ImageIndex = ((int)(resources.GetObject("toolBarButton_Usual.ImageIndex")));
			this.toolBarButton_Usual.Visible = ((bool)(resources.GetObject("toolBarButton_Usual.Visible")));
			// 
			// toolBarButton_Delete
			// 
			this.toolBarButton_Delete.Enabled = ((bool)(resources.GetObject("toolBarButton_Delete.Enabled")));
			this.toolBarButton_Delete.ImageIndex = ((int)(resources.GetObject("toolBarButton_Delete.ImageIndex")));
			this.toolBarButton_Delete.Visible = ((bool)(resources.GetObject("toolBarButton_Delete.Visible")));
			// 
			// imageList1
			// 
			this.imageList1.Images.Add(((System.Drawing.Image)(resources.GetObject("resource"))));
			this.imageList1.Images.Add(((System.Drawing.Image)(resources.GetObject("resource1"))));
			this.imageList1.ImageSize = ((System.Drawing.Size)(resources.GetObject("imageList1.ImageSize")));
			// 
			// StatisticsForm
			// 
			this.ClientSize = ((System.Drawing.Size)(resources.GetObject("$this.ClientSize")));
			this.Controls.Add(this.statsListView);
			this.Controls.Add(this.toolBar);
			this.Enabled = ((bool)(resources.GetObject("$this.Enabled")));
			this.Font = ((System.Drawing.Font)(resources.GetObject("$this.Font")));
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.Location = ((System.Drawing.Point)(resources.GetObject("$this.Location")));
			this.Menu = this.mainMenu1;
			this.Text = resources.GetString("$this.Text");
			this.Visible = ((bool)(resources.GetObject("$this.Visible")));
			this.Load += new System.EventHandler(this.StatisticsForm_Load);

		}
		#endregion

		#region IListViewForm Members

		public ToolBarButton DeleteButton
		{
			get
			{
				return toolBarButton_Delete;
			}
		}

		public ToolBarButton EditButton
		{
			get
			{
				// TODO:  Add StatisticsForm.EditButton getter implementation
				return null;
			}
		}

		public ToolBarButton NewButton
		{
			get
			{
				// TODO:  Add StatisticsForm.NewButton getter implementation
				return null;
			}
		}

		public ToolBarButton UpButton
		{
			get
			{
				// TODO:  Add StatisticsForm.UpButton getter implementation
				return null;
			}
		}

		public ToolBarButton DownButton
		{
			get
			{
				// TODO:  Add StatisticsForm.DownButton getter implementation
				return null;
			}
		}

		public IItemPropertiesForm CreatePropertiesForm(FridayShopping.DataModel.ItemBase item)
		{
			// TODO:  Add StatisticsForm.CreatePropertiesForm implementation
			return null;
		}

		#endregion

		private void StatisticsForm_Load(object sender, System.EventArgs e)
		{
			listFormManager.FillListView();

			listFormManager.EnableDisableItems();		
		
		}

		private void toolBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			listFormManager.ToolbarEventsHandler(e);
		}

		private void statsListView_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			listFormManager.EnableDisableItems();
		}
	}
}
